<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <title>Title</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/bootstraptable/bootstrap-table.min.css" rel="stylesheet">
    <style>
        .text_bottom_border{
            border: none;
            border-bottom: 1px solid black;
        }

        .text_no_border{
            border: none;
        }
    </style>
</head>
<body>
<div class="container">
    <div style="width: 1200px;margin: 0 auto;">
        <h5 style="color: #3e79b6">您正在做的业务是：生产管理--产品生产工序设计--产品生产工序设计单审核</h5>
    </div>

    <div class="panel panel-default">
        <form id="module_form" class="form-horizontal">
            <div class="panel-heading" style="text-align: right">
                <button type="button" id="return_btn"class="btn btn-info">返回</button>
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="col-sm-4 control-label">产品名称：</label>
                        <div class="col-sm-8">
                            <input type="text" name="productName" id="productName"
                                   class="form-control text_no_border"
                                   value="">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <label class="col-sm-4 control-label">产品编号：</label>
                        <div class="col-sm-8">
                            <input type="text" name="productId" id="productId"
                                   class="form-control text_no_border"
                                   value="">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="col-sm-4 control-label" for="designer">设计人：</label>
                        <div class="col-sm-8">
                            <input type="text" name="designer" id="designer"
                                   class="form-control text_no_border"
                                   value="">
                        </div>
                    </div>
                </div>
                <!--物料明细表格-->
                <table id="module_details_table" >

                </table>

                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="col-sm-4 control-label" for="register">登记人：</label>
                        <div class="col-sm-8">
                            <input type="text" name="register" id="register"
                                   class="form-control text_no_border"
                                   value="">
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <label class="col-sm-4 control-label" for="registerTime">登记时间：</label>
                        <div class="col-sm-8">
                            <input type="text" name="registerTime" id="registerTime"
                                   class="form-control text_no_border"
                                   value="">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-6">
                        <label class="col-sm-4 control-label" for="procedureDescribe">设计要求：</label>
                        <div class="col-sm-8">
                            <input type="text" name="procedureDescribe" id="procedureDescribe"
                                   class="form-control text_no_border"
                                   value="">
                        </div>
                    </div>
                </div>

            </div>
        </form>
    </div>
</div>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>
<script>
    $(function () {
        //从页面作用域取出id
        let id = localStorage.getItem("id")

        //根据id查询对应的产品档案
        $.get("/design/procedure/designProcedureGetId", {"id": id}, function (data) {
            //设置产品名称和产品编号的回显
            $("#module_form #productId").val(data.productId)
            $("#module_form #productName").val(data.productName)
            $("#module_form #designer").val(data.designer)
            $("#module_form #register").val(data.register)
            $("#module_form #registerTime").val(data.registerTime)
            $("#module_form #procedureDescribe").val(data.procedureDescribe)
        }, "json")

        //初始化dom刷新表格
        $("#module_details_table").bootstrapTable({
            //请求方式
            method: "post",
            //内容类型：如果请求方式是post，内容类型必须是application/x-www-form-urlencoded
            contentType: "application/x-www-form-urlencoded",
            //请求路径
            url: '/procedure/details/procedureDetailsPage',
            //数据行交替样式
            striped: true,
            //是否是服务器端分页：server表示服务器端，client表示前端分页
            sidePagination: 'server',
            //初始化加载第一页
            pageNumber: 1,
            //是否分页
            pagination:true,
            //单页记录数，页大小
            pageSize: 5,
            //分页列表
            pageList: [2, 5, 10, 20],
            //刷新按钮
            //showRefresh:true,
            //请求参数
            queryParams: function (params) {
                let obj = {
                    //params.limit获取组件中的页大小
                    //params.offset获取请求数据的起始索引
                    pageSize: params.limit,
                    pageNo: (params.offset / params.limit) + 1,
                    parentId:id
                }
                return obj;
            },
            //表格列标题
            columns: [{
                title: "序号",
                field: "id",
                formatter: function (value, row, index) {
                    let html = `<a href="#">${value}</a>`
                    return html
                }
            },{
                title: "工序名称",
                field: "procedureId"
            },{
                title: "工序编号",
                field: "procedureName"
            },{
                title: "描述",
                field: "procedureDescribe"
            },{
                title: "工时数",
                field: "labourHourAmount"
            },{
                title: "单位",
                field: "amountUnit"
            },{
                title: "单位工时成本",
                field: "costPrice"
            },{
                title: "工时单位小计(元)",
                field: "subtotal"
            }]
        })

        //点击返回按钮
        $("#return_btn").click(function () {
            window.location="/procedure/design_procedure_listUI"
        })
    })
</script>
</body>
</html>